package cn.white.ymc.mvvmmaster.data.util

import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkInfo

/**
 * 判断当前网络
 *
 */

object NetworkUtils {

    fun isConnected(context: Context?): Boolean {
        val mConnectivityManager = context!!
                .getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
        val mNetworkInfo = mConnectivityManager.activeNetworkInfo
        if (mNetworkInfo != null) {
            return mNetworkInfo.isAvailable
        }
        return false
    }

}
